﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DropItemController : MonoBehaviour
{
    Vector3 aa;
    int speet = 0;
    private void Start()
    {
        //gameObject.transform.localPosition = new Vector3(-0.13f, 0.57f, 4.36f);
        
    }
    private void Update()
    {
        if(speet == 0)
        {
            Invoke("toto", 0.5f);
        }
        else
        {
            aa = GameObject.Find("PlayEvent").transform.position;
            this.gameObject.transform.position = Vector3.MoveTowards(this.gameObject.transform.position, aa, speet * Time.deltaTime);
        }
        
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.name == "PlayEvent")
        {
            speet = 0;
            gameObject.transform.localPosition = new Vector3(0.99f, 1.14f, 18.82f);
            gameObject.SetActive(false);
        }
    }
    private void toto()
    {
        speet = 6;
    }

}
